package com.business_clean.ui.activity.personnel;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;

import com.business_clean.R;
import com.business_clean.app.base.BaseAgentWebActivity;
import com.business_clean.app.ext.CommonUtils;
import com.business_clean.app.network.NetUrl;
import com.business_clean.app.uitl.ActivityForwardUtil;
import com.business_clean.databinding.ActivityPersonnelDetailBinding;
import com.business_clean.databinding.ActivityTodoDetailBinding;
import com.business_clean.ui.activity.attendance.MyAttendanceActivity;
import com.business_clean.ui.activity.custom.AddProjectActivity;
import com.business_clean.ui.activity.depart.QuickDepartActivity;
import com.just.agentweb.WebChromeClient;
import com.just.agentweb.WebViewClient;

import me.hgj.mvvmhelper.base.BaseViewModel;

public class PersonnelDetailActivity extends BaseAgentWebActivity<BaseViewModel, ActivityPersonnelDetailBinding> {


    private String uuid;

    @Override
    public void initView(Bundle savedInstanceState) {
        if (getIntent() != null && getIntent().getExtras() != null) {
            uuid = getIntent().getExtras().getString("uuid");
        }
    }

    @Override
    public void onBindViewClick() {
        //考勤统计
        mDatabind.tvAttendanceStat.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Bundle bundle = new Bundle();
                bundle.putString("uuid", uuid);
                ActivityForwardUtil.startActivity(MyAttendanceActivity.class, bundle);
            }
        });
        //离职
        mDatabind.tvQuick.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Bundle bundle = new Bundle();
                bundle.putString("uuid", uuid);
                ActivityForwardUtil.startActivity(QuickDepartActivity.class, bundle);
            }
        });
        //编辑
        mDatabind.tvEdit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Bundle bundle = new Bundle();
                bundle.putInt("type", 3);//3是档案编辑
                bundle.putString("uuid", uuid);
                ActivityForwardUtil.startActivity(AddProjectActivity.class, bundle);
            }
        });
    }

    @Override
    public void initObserver() {

    }

    @Override
    protected ViewGroup getAgentWebParent() {
        return mDatabind.llLayout;
    }


    @Override
    protected String getUrl() {
        return  CommonUtils.getWebUrlHost() + NetUrl.WEB_PROJECT_FILE_DETAIL_URL + "uuid=" + uuid;
    }
}